﻿@page "/channel"
@inject IStorageService StorageService
@inject AuthenticationStateProvider AuthenticationStateProvider

<MVirtualScroll Height=@("calc(100vh - 140px)") OverscanCount=0 ItemHeight=64 Items="_channels">
    <ItemContent>
        <MDivider Style="background-color: var(--app-bar-background-color)"> @context.CreatedTime.ToString("yyyy-MM-dd")</MDivider>
        <MListItem Class="channel-message">
            <MListItemAction>
                <MAvatar Size="35">
                    <PersonalInformation @bind-Value=context.Show TheirUserId=context.TheirUserId>
                        <ActivatorContent Context="data">
                            <div class="text-center border-left-solid" style="width:88px;">
                                <MAvatar Attributes="data.Attrs" Size=40>
                                    <MImage Src="https://cdn.discordapp.com/avatars/924900818090602526/23dcd2c492ffe184cdaf193bb6c899ab.webp?size=128"></MImage>
                                </MAvatar>
                            </div>
                        </ActivatorContent>
                    </PersonalInformation>
                </MAvatar>
            </MListItemAction>

            <MListItemContent>
                <MListItemTitle>
                    <span style="color: cornflowerblue;">Token</span>
                </MListItemTitle>
                <MListItemContent>
                    <MMarkdownIt Source="@context.Message" Class="markdown-parser__basic"  />
                    
                </MListItemContent>
            </MListItemContent>

            <MListItemAction>
            </MListItemAction>

        </MListItem>

    </ItemContent>
</MVirtualScroll>

<MFooter Style="background-color:var(--app-bar-background-color);">
    <MResponsive MaxHeight="100">
        <MTextarea Dense
                   Flat
                   HideDetails="@("true")"
                   OnKeyDown="SendMessage"
                   SoloInverted
         @bind-Value="Message"></MTextarea>
         </MResponsive>
</MFooter>
